package com.base.mine;

import android.support.v4.app.FragmentTransaction;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.base.commonlib.base.CBaseBarMvpActivity;
import com.base.mine.databinding.ActivityInfomodifyBinding;
import com.base.mine.fag.ModifyBirthdayFragment;
import com.base.mine.fag.ModifySexFragment;

/**
 * 信息修改界面
 * Created by weikailiang on 2020/3/26.
 */
@Route(path = "/mine/infomodify")
public class InfoModifyActivity extends CBaseBarMvpActivity{


    private ActivityInfomodifyBinding mBinding;
    @Autowired
    int type;
    @Autowired
    String title;
    @Override
    protected int getLayoutResource() {
        return R.layout.activity_infomodify;
    }

    @Override
    protected void init() {
        super.init();
        mBinding = (ActivityInfomodifyBinding) mRootBinding;
        setBackNavigation();
        setBarTitle(title);
    }

    @Override
    protected void start() {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        switch (type){
            case 1:
                //修改性别
                transaction.add(R.id.container, new ModifySexFragment(), ModifySexFragment.class.getName());
                break;
            case 2:
                //修改出生日期
                transaction.add(R.id.container, new ModifyBirthdayFragment(), ModifyBirthdayFragment.class.getName());
                break;
        }
        transaction.commitAllowingStateLoss();
    }
}
